<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="__ADMIN__/css/pintuer.css">
    <link rel="stylesheet" href="__ADMIN__/css/admin.css">
    <script src="__ADMIN__/js/jquery.js"></script>
    <script src="__ADMIN__/js/pintuer.js"></script>

    <style type="text/css">

    </style>
</head>
<body>
<form method="post" action="" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 位置详情列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li> <a class="button border-main icon-plus-square-o" href="{:url('admin/banneritem/add',['banner_id'=>$banner_id])}"> 添加位置详情</a> </li>
                <li>搜索：</li>
                <li>
                    <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
                    <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a>
                </li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="100" style="text-align:left; padding-left:20px;">ID</th>
                <th>详情图片</th>
                <th>详情链接</th>
                <th>位置所属</th>
                <th>详情排序</th>
                <th>详情状态</th>
                <th>详情描述</th>
                <th width="90">创建时间</th>
                <th width="200">操作</th>
            </tr>
            {volist name="list" id="v"}
            <tr>
                <td>{$v.id}</td>
                <td><a target="_blank" href="/{$v.pic}"><img src="/{$v.sm_pic}" style="width:80px;height: 60px;border-radius:4px;" alt=""/></a></td>
                <td>{$v.link}</td>
                <td>{$v.banner.name}</td>
                <td>{$v.order}</td>
                {switch name="v.status"}
                {case value="应用"}<td>{$v.status}</td>{/case}
                {case value="禁用"}<td style="color:red;">{$v.status}</td>{/case}
                {/switch}
                <td title="{$v.pic_desc}">{$v.pic_desc|mb_substr=0,10}</td>
                <td>{$v.create_time}</td>
                <td>
                    <div class="button-group">
                        <a type="button" class="button border-main" href="{:url('admin/banneritem/edi',['id'=>$v.id])}"><span class="icon-edit"></span>修改</a>
                        <a class="button border-red" href="#" onclick="return del({$v.id})"><span class="icon-trash-o"></span> 删除</a>
                    </div>
                </td>
            </tr>
            {/volist}
            <tr>
                <td colspan="9">
                    {$page}
                </td>
            </tr>
        </table>
    </div>
</form>
<script type="text/javascript">

    //搜索
    function changesearch(){

    }

    //单个删除
    function del(id){
        if(confirm("您确定要删除吗?")){
            $.ajax({
                type : "GET",
                url : "{:url('admin/banneritem/del')}",
                data : "id="+id,
                dataType :'json',
                success:function (data) {
//                    console.log(data);
                    alert(data);
                    location.reload(true);
                },
                error:function (data) {
                },
            })
        }else{
            return false;
        }
    }

    //全选
    $("#checkall").click(function(){
        $("input[name='id[]']").each(function(){
            if (this.checked) {
                this.checked = false;
            }
            else {
                this.checked = true;
            }
        });
    })

    //批量删除
    function DelSelect(){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){
            var t=confirm("您确认要删除选中的内容吗？");
            if (t==false) return false;
            $("#listform").submit();
        }
        else{
            alert("请选择您要删除的内容!");
            return false;
        }
    }

    //批量排序
    function sorts(){
        var Checkbox=false;
        $("input[name='id[]']").each(function(){
            if (this.checked==true) {
                Checkbox=true;
            }
        });
        if (Checkbox){

            $("#listform").submit();
        }
        else{
            alert("请选择要操作的内容!");
            return false;
        }
    }


</script>
</body>
</html>